/*    */ package com.wzh.action.collect;
/*    */ 
/*    */ import com.opensymphony.xwork2.ActionContext;
/*    */ import com.opensymphony.xwork2.ActionSupport;
/*    */ import com.wzh.bean.user.UserInfo;
/*    */ import com.wzh.service.user.UserService;
/*    */ import java.util.Map;
/*    */ import javax.annotation.Resource;
/*    */ import org.springframework.stereotype.Controller;
/*    */ 
/*    */ @Controller
/*    */ public class AutoCollectAction extends ActionSupport
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/*    */ 
/*    */   @Resource
/*    */   private UserService userService;
/*    */   private UserInfo user;
/* 26 */   private int siteid = 0;
/*    */ 
/*    */   public int getSiteid()
/*    */   {
/* 30 */     return this.siteid;
/*    */   }
/*    */ 
/*    */   public void setSiteid(int siteid) {
/* 34 */     this.siteid = siteid;
/*    */   }
/*    */ 
/*    */   public UserInfo getUser() {
/* 38 */     return this.user;
/*    */   }
/*    */ 
/*    */   public void setUser(UserInfo user) {
/* 42 */     this.user = user;
/*    */   }
/*    */ 
/*    */   public String collect()
/*    */   {
/* 48 */     String urladdress = "/control/collect/startcollect?siteinfo.id=" + this.siteid;
/* 49 */     checkInfo("3秒后自动采集", urladdress);
/*    */ 
/* 51 */     return "automessage";
/*    */   }
/*    */ 
/*    */   public String update()
/*    */   {
/* 58 */     String urladdress = "/control/collect/update/start?siteinfo.id=" + this.siteid;
/* 59 */     checkInfo("3秒后自动开始更新", urladdress);
/*    */ 
/* 61 */     return "automessage";
/*    */   }
/*    */ 
/*    */   private void checkInfo(String message, String urladdress) {
/* 65 */     if (this.siteid == 0) {
/* 66 */       ActionContext.getContext().put("message", "请输入siteid");
/* 67 */       ActionContext.getContext().put("urladdress", "/");
/*    */     }
/* 69 */     if (this.user != null) {
/* 70 */       UserInfo userInfo = this.userService.find(this.user.getUsername(), this.user.getPassword());
/*    */ 
/* 72 */       if (userInfo != null) {
/* 73 */         ActionContext.getContext().getSession().put("user", userInfo);
/* 74 */         ActionContext.getContext().put("message", message);
/* 75 */         ActionContext.getContext().put("urladdress", urladdress);
/*    */       }
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\work\apache-tomcat-7.0.55\webapps\ROOT\WEB-INF\classes\
 * Qualified Name:     com.wzh.action.collect.AutoCollectAction
 * JD-Core Version:    0.6.1
 */